<?php
namespace app\admin\model;

use think\facade\Db;
use think\Model;
use think\facade\Request;
use think\model\concern\SoftDelete;

class Member extends Model
{
    use SoftDelete;
    protected $pk = 'user_id';
    protected $deleteTime = 'delete_time';
    public static function getMemberInfo($where,$data)
    {
        $list = Member::field(true)
            ->where($where)
            ->paginate([
                'list_rows'=>5,
                'query'=>$data
            ]);
        return $list;
    }
    //会员单个软删除
    public static function memberDel($get)
    {
        $res = Member::destroy($get['id']);
        return $res;
    }
    //会员多个软删除
    public static function memberDels($get)
    {
        $id = explode(',',$get['id']);
        $res = Member::destroy($id);
        return $res;
    }
    //会员添加
    public static function addMemberAttr($add)
    {
        try{
            $res = Member::strict(true)->save($add);
        }catch (\Exception $e){
            $res = false;
            echo $e->getMessage();
        }
        return $res;
    }


}